﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace day4_case1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //string[,] booklist = new string[3, 2]
            //{{"1","c#"},
            //{"2","c#"},
            //{"3","c#"}
            //};

            //booklist[0, 1] = "c#.net项目开发";  // 修改0，1
            //for (int i = 0; i < booklist.GetLength(0); i++)
            //{
            //    for (int j = 0; j < booklist.GetLength(1); j++)
            //    {
            //        Console.WriteLine("{0}", booklist[i, j]);

            //    }
            //    Console.WriteLine();

            //}
            //Console.Read();


            //string[] student = new string[3] { "z3", "l4", "w5" };
            //ArrayList arr = new ArrayList(student);
            //Console.WriteLine("集合1:");
            //foreach (string stu in arr) Console.WriteLine(stu);


            //ArrayList arr = new ArrayList();
            //arr.Add("chapter1");
            //arr.Add("chapter2");
            //arr.Add("chapter3");
            //Console.WriteLine("开始插入");
            //arr.Insert(0, "chapter0");
            //foreach (string item in arr)
            //{
            //    Console.WriteLine(item);
            //}
            //Console.WriteLine("开始删除");
            //arr.Remove("chapter2");
            //arr.RemoveAt(2);
            //foreach (string item in arr)
            //{
            //    Console.WriteLine(item);
            //}


            //ArrayList arr = new ArrayList();
            //string[] book1 = new string[4] { "1", "netbook", "$50", "liuyani" };
            //string[] book2 = new string[4] { "2", "cbook", "$30", "wangwu" };
            //string[] book3 = new string[4] { "3", "c#book", "$40", "l4" };
            //arr.Add(book1);
            //arr.Add(book2);
            //arr.Add(book3);
            //Console.WriteLine("序号\t书名\t价格\t作者\t");
            //foreach (string []b in arr)
            //{
            //    Console.Write("{0}\t", b[0]);  //第一列
            //    Console.Write("{0}\t", b[1]);  //第二列
            //    Console.Write("{0}\t", b[2]);  //第三列
            //    Console.Write("{0}\t", b[3]);  //第四列
            //    Console.WriteLine();
            //}



            //int i = 8, j = 9;
            //int k = getSum(i, j);
            //Console.WriteLine("{0}和{1}的和是{2}", i, j, k);
            //Console.Read();


            //            int a = 20;
            //            Console.WriteLine("调用函数之前 a:{0}", a);
            //            example( a);  //值传递
            //            Console.WriteLine("调用函数之后 a:{0}", a);
            ////            调用函数之前 a:20
            ////调用函数的内部 a:400
            ////调用函数之后 a:20

            //        }

            //        static void example( int a)
            //        {
            //            a = a * a;
            //            Console.WriteLine("调用函数的内部 a:{0}", a);
            //        }



            //int a = 20;
            //Console.WriteLine("调用函数之前 a:{0}", a);
            //example(ref a);  //引用传递
            //Console.WriteLine("调用函数之后 a:{0}", a);
            ////调用函数之前 a:20
            ////调用函数的内部 a:400
            ////调用函数之后 a:400



            //try  {  }
            //catch (Exception ex){ }
            //finally { }

        }

        static void example(ref int a)
        {
            a = a * a;
            Console.WriteLine("调用函数的内部 a:{0}", a);
        }



        static int getSum(int a, int b)
        {
            return a + b;
        }

    }
}
